import {Component, OnInit} from '@angular/core';
import {Hero} from '../hero';
import {HEROES} from '../mock-heroes';

@Component({
  selector: 'app-heroes',
  templateUrl: './heroes.component.html',
  styleUrls: ['./heroes.component.css']
})
/**
 * 始终要 export 这个组件类，以便在其它地方（比如 AppModule）导入它
 */
export class HeroesComponent implements OnInit {

  heroes = HEROES;

  selectedHero?: Hero;

  constructor() {
  }

  ngOnInit(): void {

  }

  onSelect(hero: Hero): void {
    this.selectedHero = hero;
  }

}
